package com.lixw.saa.controller;

import org.springframework.ai.chat.model.ChatModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

/**
 * @ClassName: ChatHelloController
 * @Description:
 * @Author: xuweiLi
 * @Create: 2025/10/2 11:35
 **/
@RestController
public class ChatHelloController {

    @Autowired
    private ChatModel chatModel;

    @GetMapping("/hello/chat")
    public String chat(@RequestParam(value = "msg",defaultValue = "你是谁") String msg ) {
        return chatModel.call(msg);
    }

    @GetMapping("/hello/stream")
    public Flux<String> stream(@RequestParam(value = "msg",defaultValue = "你是谁") String msg ) {
        return chatModel.stream(msg);
    }
}